package Lock;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created with IntelliJ IDEA.
 * User: belict
 * Date: 12/1/13
 * Time: 4:32 PM
 * To change this template use File | Settings | File Templates.
 */
public class Run {
    public static void main(String[] args) throws InterruptedException {
        final ReentrantLockDemo reentrantLockDemo = new ReentrantLockDemo();

        ExecutorService service = Executors.newCachedThreadPool();

        Callable<Object> run1 = new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                reentrantLockDemo.start();
                return null;
            }
        };

        Callable<Object> run2 = new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                reentrantLockDemo.start();
                return null;
            }
        };


        List list = new ArrayList();
        list.add(run1);
        list.add(run2);

        service.invokeAll(list);

    }
}
